<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ page import="java.io.*, java.sql.*, java.util.*,LS.*, date.*"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>



<!DOCTYPE html>
<html lang="UTF-8">
<style>
table {
	width: 90%;
	margin-left: 20px;
}

.panality {
	font-weight: bolder;
	color: red;
}

.title {
	width: 20%;
	margin: 0px;
	font-weight: bolder;
	padding: 10px;
	padding-right: 20px;
	text-align: right;
}
/* td,tr{ */
/* 	font-weight:bolder; */
/* 	padding:10px; */
/* } */
#outerview {
	padding-top: 10px;
	margin-left: 0px;
	text-align: center;
	background-color: #fff;
	border: 1px solid #e5e5e5;
	-webkit-border-radius: 5px;
	-moz-border-radius: 5px;
	border-radius: 5px;
	-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
	-moz-box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
	box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
}

#outerview {
	width: 100%;
	min-height: 550px;
	padding: 0px;
}

#middleview {
	width: 90%;
	height: 420px;
	margin: 0px auto 0px auto;
	left: 50%;
}

#innerview {
	margin-top: 30px;
	width: 100%;
	height: 100%;
	text-align: center;
	background-color: #fff;
	border: 1px solid #e5e5e5;
	-webkit-border-radius: 5px;
	-moz-border-radius: 5px;
	border-radius: 5px;
	-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
	-moz-box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
	box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
}

#picture {
	padding-top: 10px;
	width: 200px;
	height: 100%;
	text-align: right;
	background-color: #fff;
	border: 1px solid #e5e5e5;
	-webkit-border-radius: 5px;
	-moz-border-radius: 5px;
	border-radius: 5px;
	-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
	-moz-box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
	box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
}

.btntd {
	text-align: center;
}

.rightdiv {
	text-align: right;
}

#addsuccess {
	border: 1px solid #000000;
}
</style>

<head>
	
	<meta charset="utf-8">
	<title>성공회대학교 기자재 대여 시스템</title>
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	
	<!-- styles시트 -->
	<link href="assets/css/bootstrap.css" rel="stylesheet">
	<link href="assets/css/bootstrap-responsive.css" rel="stylesheet">
	<link href="assets/css/docs.css" rel="stylesheet">
	
	<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.min.js"></script>    
	<script type="text/javascript">

	 	var pw_regex = /^[a-zA-Z0-9_-]{6,18}$/;
		
		function modifyBtnClick() {
			// 빈칸 일경우
			if($('#pw').val() == ""
					|| $('#pw1').val() == ""
					|| $('#pw2').val() == ""
					) {
				alert("비밀번호를 입력하세요.");
			}
			// 변경할 비밀번호를 다르게 입력했을 경우.
			else if($('#pw1').val() != $('#pw2').val()
					) {
				alert("변경할 비밀번호가 다릅니다.");
			}
			// 변경 사항이 없을경우
			else if($('#pw').val() == $('#pw1').val()
					) {
				alert("변경사항이 없습니다.");
			}
			// 형식이 맞지 않을경우
			else if(pw_regex.test($('#pw1').val()) == false) {
				alert("비밀번호는 6자 이상 18자 이하의 영어 대소문자와 숫자의 조합으로 이루어져야 합니다.");
			}
			// 성공(비밀번호 검사는 컨트롤러 에서)
			else if(confirm("변경 하시겠습니까?")){
				
				$('#fm').submit();
			}
		}
		
	</script>
</head>

<body data-spy="scroll" data-target=".bs-docs-sidebar">
	<!-- 메뉴
    ================================================== -->
    
    
	<%
	Users u = (Users)session.getAttribute("user");
	if(u==null) {%>
	<jsp:include page="/top.do"></jsp:include>
	<%}else{
	    	if(u.getUser_position().equalsIgnoreCase("S")){%>
	<!-- 학생이 로그인 했을 경우 메뉴 -->
	<jsp:include page="/studenttop.do"></jsp:include>
	<%}else if(u.getUser_position().equalsIgnoreCase("P")) {%>
	<!-- 교수가 로그인 했을 경우 메뉴 -->
	<jsp:include page="/teachertop.do"></jsp:include>
	<%}else{%>
	<!-- 관리자가 로그인 했을 경우 메뉴 -->
	<jsp:include page="/managertop.do"></jsp:include>
	<%}}%>
	<!-- 게시판
    ================================================== -->
	<div style="text-align: center">
		<div class="marketing"
			style="margin-bottom: 30px; color: #000; text-align: left">
			<div class="container">
				<h3 style="margin: 10px; font-size: 35px;">
					<strong>내 정보</strong>
				</h3>
			</div>
		</div>
	</div>
	
	<div class="container">
		<div id="outerview">
			<div id="middleview">
				<% if(u != null) { %>
				<div id="innerview">
					<div class="control-gruop">
					
						<form id="fm" action="modifyPwBtn.do" method="post" class="form-inline" style="text-align: left;">
							<div class="controls">
								<br>
								<table>
									
									<tr>
										<td class="title">현제 비밀번호</td>
										<td><input id="pw" name="pw" type="password" class="input-middle"></td>
									</tr>
									<tr>
										<td class="title">변경할 비밀번호</td>
										<td><input id="pw1" name="pw1" type="password" class="input-middle"></td>
									</tr>
									
									<tr>
										<td class="title">변경할 비밀번호 확인</td>
										<td><input id="pw2" name="pw2" type="password" class="input-middle"></td>
									</tr>
								</table>
							</div>
						</form>
					</div>
				</div>
				<div class="rightdiv">
					<button onclick="modifyBtnClick()" class="btn" id="modifyBtn">수정 완료</button>
				</div>
				<% } %>
			</div>
		</div>
	</div>
	<!-- 꼬리말
    ================================================== -->
	<footer class="footer">
		<div class="container">
			<p>Copyright SKHU. Software Student.</p>
		</div>
	</footer>

	<!-- javascript -->
	<script src="assets/js/jquery.js"></script>
	<script type="text/javascript" src="assets/js/bootstrap.js"></script>
	<script type="text/javascript">
		$(document).ready(function() {
			$('.dropdown-toggle').dropdown();
		});
	</script>
</body>
</html>
